package de.regoert.javaee.test_jee_webapp;

import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

@ManagedBean
@RequestScoped
public class IndexController {
	
//	@EJB(name="ejb/NewSessionBean", beanName="NewSessionBean")
//	private NewSessionBean newSessionBean;
	
	private String text;
	
	public String getDatetime(){
		Date d = new Date();
		Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return formatter.format(d);
	}
	
//	public String getNewSessionBeanBusinessMethod(){
//		return newSessionBean.businessMethod();
//	}
	
	 public String onClick() {
	        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", getDatetime()));
	        return null;
	 }

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}
    

	
}
